/*
 * Copyright (C) Francisco Morero Peyrona. All rights reserved.
 *
 * This software is published under the terms of Open Source
 * License version 1.1, a copy of which has been included with this
 * distribution in the License.txt file.
 */

package jdbcmanager.udt;

import java.awt.*;
import javax.swing.*;

import jdbcmanager.dbtools.*;
import jdbcmanager.dbtools.datatypes.*;
import jdbcmanager.swing.table.*;

/**
 * 
 * @author f.morero
 */
public final class DbUDT extends JPanel
{
   public DbUDT( UDTDefinition udt )
   {
      setLayout( new BorderLayout() );
      setBorder( BorderFactory.createEmptyBorder( 10,10,10,10 ) );
      
      add( createTable( udt ), BorderLayout.CENTER );
   }
   
   private JxTableMap createTable( UDTDefinition udt )
   {
   		String sSchema = DbUtil.getAgentDBMS().getAgentMetaData().getSchemaTerm();
    
	   	JxTableMap table = new JxTableMap();
	   	           table.addRow( "Catalog"   , udt.getCatalog()      );
	               table.addRow( sSchema     , udt.getSchema()       );
	               table.addRow( "Name"      , udt.getName()         );
	               table.addRow( "Class name", udt.getClassName()    );
	               table.addRow( "Data type" , udt.getDataTypeName() );
	               table.addRow( "Comments"  , udt.getComments()     );
    	return table;
   }
}